package com.bkitclub.mobiledevcamp.horseword.util;

import android.widget.FrameLayout;

public class Const {
	private static final int POSITION_MAIN_SCREEN_EXIT_HUGE_X = 1045;
	private static final int POSITION_MAIN_SCREEN_EXIT_HUGE_Y = 154;
	
	private static final int POSITION_MAIN_SCREEN_PLAY_HUGE_X = 916;
	private static final int POSITION_MAIN_SCREEN_PLAY_HUGE_Y = 461;
	
	
	
	
	private static final int POSITION_MAIN_SCREEN_PLAY_LARGE_X = 556;
	private static final int POSITION_MAIN_SCREEN_PLAY_LARGE_Y = 227;
	
	private static final int POSITION_MAIN_SCREEN_EXIT_LARGE_X = 631;
	private static final int POSITION_MAIN_SCREEN_EXIT_LARGE_Y = 91;
	
	private static final int SIZE_LATEST_WORD_HUGE = 480;
	
	private static final int SIZE_LATEST_WORD_LARGE = 310;
	
	private static final int POSITION_PLAY_SCREEN_LASTEST_HUGE_X = 76;//240 - 41 * 4
	private static final int POSITION_PLAY_SCREEN_LASTEST_HUGE_Y = 48;
	
	private static final int POSITION_PLAY_SCREEN_LASTEST_LARGE_X = 59;//155 -> - 24 * 4
	private static final int POSITION_PLAY_SCREEN_LASTEST_LARGE_Y = 30;//40
	
	private static final int POSITION_PLAY_SCREEN_MY_OPTION_WIDTH_HUGE = 55;
	private static final int POSITION_PLAY_SCREEN_MY_OPTION_WIDTH_LARGE = 33;
	
	private static final int POSITION_PLAY_SCREEN_YOUR_OPTION_WIDTH_HUGE = 41;
	private static final int POSITION_PLAY_SCREEN_YOUR_OPTION_WIDTH_LARGE = 24;
	
	private static final int POSITION_PLAY_SCREEN_MY_OPTION_HUGE_X = 14;
	private static final int POSITION_PLAY_SCREEN_MY_OPTION_HUGE_Y = 374;
	
	private static final int POSITION_PLAY_SCREEN_MY_OPTION_LARGE_X = 19;
	private static final int POSITION_PLAY_SCREEN_MY_OPTION_LARGE_Y = 224;
	
	private static final int POSITION_PLAY_SCREEN_YOUR_OPTION_HUGE_X = 234;
	private static final int POSITION_PLAY_SCREEN_YOUR_OPTION_HUGE_Y = 466;
	
	private static final int POSITION_PLAY_SCREEN_YOUR_OPTION_LARGE_X = 156;
	private static final int POSITION_PLAY_SCREEN_YOUR_OPTION_LARGE_Y = 278;
	
	private static final int POSITION_PLAY_SCREEN_CROSSWORD_HUGE_X = 514;
	private static final int POSITION_PLAY_SCREEN_CROSSWORD_HUGE_Y = 49;
	
	private static final int POSITION_PLAY_SCREEN_CROSSWORD_LARGE_X = 316;
	private static final int POSITION_PLAY_SCREEN_CROSSWORD_LARGE_Y = 30;
	
	
	private static final int SIZE_PER_CELL_PLAY_SCREEN_HUGE = 78;//78
	private static final int SIZE_PER_CELL_PLAY_SCREEN_LARGE = 53;//53
	
	private static final int SIZE_PER_CELL_PLAY_SCREEN_SPACE_HUGE = 13;//78
	private static final int SIZE_PER_CELL_PLAY_SCREEN_SPACE_LARGE = 0;//53
	
	private static final int MY_OPTION_SIZE_PER_CELL_PLAY_SCREEN_HUGE = 53;//78
	private static final int MY_OPTION_SIZE_PER_CELL_PLAY_SCREEN_LARGE = 31;//53
	
	private static final int YOUR_OPTION_SIZE_PER_CELL_PLAY_SCREEN_HUGE = 45;//78
	private static final int YOUR_OPTION_SIZE_PER_CELL_PLAY_SCREEN_LARGE = 25;//53
	
	private static final int POSITION_PLAY_SCREEN_MY_SCORE_HUGE_X = 116;
	private static final int POSITION_PLAY_SCREEN_MY_SCORE_HUGE_Y = 272;
	
	private static final int POSITION_PLAY_SCREEN_MY_SCORE_LARGE_X = 79;
	private static final int POSITION_PLAY_SCREEN_MY_SCORE_LARGE_Y = 161;
	
	private static final int POSITION_PLAY_SCREEN_YOUR_SCORE_HUGE_X = 397;
	private static final int POSITION_PLAY_SCREEN_YOUR_SCORE_HUGE_Y = 222;
	
	private static final int POSITION_PLAY_SCREEN_YOUR_SCORE_LARGE_X = 240;
	private static final int POSITION_PLAY_SCREEN_YOUR_SCORE_LARGE_Y = 126;
	
	
	private static final int POSITION_PLAY_SCREEN_BACK_HUGE_X = 374;
	private static final int POSITION_PLAY_SCREEN_BACK_HUGE_Y = 555;
	
	private static final int POSITION_PLAY_SCREEN_BACK_LARGE_X = 233;
	private static final int POSITION_PLAY_SCREEN_BACK_LARGE_Y = 331;
	
	// --- CONNECT SCREEN
	
	private static final int POSITION_CONNECT_SCREEN_BACK_HUGE_X = 1038;
	private static final int POSITION_CONNECT_SCREEN_BACK_HUGE_Y = 696;
	
	private static final int POSITION_CONNECT_SCREEN_BACK_LARGE_X = 637;
	private static final int POSITION_CONNECT_SCREEN_BACK_LARGE_Y = 417;
	
	private static final int POSITION_CONNECT_SCREEN_SELECT_HUGE_X = 625;
	private static final int POSITION_CONNECT_SCREEN_SELECT_HUGE_Y = 44;
	
	private static final int POSITION_CONNECT_SCREEN_SELECT_LARGE_X = 383;
	private static final int POSITION_CONNECT_SCREEN_SELECT_LARGE_Y = 18;
	
	private static final int POSITION_CONNECT_SCREEN_BTN_HUGE_X = 625;
	private static final int POSITION_CONNECT_SCREEN_BTN_HUGE_Y = 139;
	private static final int POSITION_CONNECT_SCREEN_BTN_HUGE_SPACE = 10;
	
	private static final int POSITION_CONNECT_SCREEN_BTN_LARGE_X = 383;
	private static final int POSITION_CONNECT_SCREEN_BTN_LARGE_Y = 77;
	private static final int POSITION_CONNECT_SCREEN_BTN_LARGE_SPACE = 7;
	
	public static void setPositionYourScore(FrameLayout.LayoutParams lp){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			lp.topMargin = POSITION_PLAY_SCREEN_YOUR_SCORE_HUGE_Y;
			lp.leftMargin = POSITION_PLAY_SCREEN_YOUR_SCORE_HUGE_X;
			break;
		case Utils.RESOURCE_TYPE_LARGE:
			lp.topMargin = POSITION_PLAY_SCREEN_YOUR_SCORE_LARGE_Y;
			lp.leftMargin = POSITION_PLAY_SCREEN_YOUR_SCORE_LARGE_X;
			break;
		default:
			lp.topMargin = (int) (POSITION_PLAY_SCREEN_YOUR_SCORE_LARGE_Y * Utils.getScale());
			lp.leftMargin = (int) (POSITION_PLAY_SCREEN_YOUR_SCORE_LARGE_X * Utils.getScale());
			break;
		}
	}
	public static void setPositionMyScore(FrameLayout.LayoutParams lp){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			lp.topMargin = POSITION_PLAY_SCREEN_MY_SCORE_HUGE_Y;
			lp.leftMargin = POSITION_PLAY_SCREEN_MY_SCORE_HUGE_X;
			break;
		case Utils.RESOURCE_TYPE_LARGE:
			lp.topMargin = POSITION_PLAY_SCREEN_MY_SCORE_LARGE_Y;
			lp.leftMargin = POSITION_PLAY_SCREEN_MY_SCORE_LARGE_X;
			break;
		default:
			lp.topMargin = (int) (POSITION_PLAY_SCREEN_MY_SCORE_LARGE_Y * Utils.getScale());
			lp.leftMargin = (int) (POSITION_PLAY_SCREEN_MY_SCORE_LARGE_X * Utils.getScale());
			break;
		}
	}
	public static int getPositionCrosswordX(){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			return POSITION_PLAY_SCREEN_CROSSWORD_HUGE_X;
		case Utils.RESOURCE_TYPE_LARGE:
			return POSITION_PLAY_SCREEN_CROSSWORD_LARGE_X;
		default:
			return (int) (POSITION_PLAY_SCREEN_CROSSWORD_LARGE_X * Utils.getScale());
		}
	}
	
	public static int getSizePerCell(){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			return SIZE_PER_CELL_PLAY_SCREEN_HUGE;
		case Utils.RESOURCE_TYPE_LARGE:
			return SIZE_PER_CELL_PLAY_SCREEN_LARGE;
		default:
			return (int) (SIZE_PER_CELL_PLAY_SCREEN_LARGE * Utils.getScale());
		}
	}
	
	public static int getMyOptionSizePerCell(){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			return MY_OPTION_SIZE_PER_CELL_PLAY_SCREEN_HUGE;
		case Utils.RESOURCE_TYPE_LARGE:
			return MY_OPTION_SIZE_PER_CELL_PLAY_SCREEN_LARGE;
		default:
			return (int) (MY_OPTION_SIZE_PER_CELL_PLAY_SCREEN_LARGE * Utils.getScale());
		}
	}
	
	public static int getYourOptionSizePerCell(){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			return YOUR_OPTION_SIZE_PER_CELL_PLAY_SCREEN_HUGE;
		case Utils.RESOURCE_TYPE_LARGE:
			return YOUR_OPTION_SIZE_PER_CELL_PLAY_SCREEN_LARGE;
		default:
			return (int) (YOUR_OPTION_SIZE_PER_CELL_PLAY_SCREEN_LARGE * Utils.getScale());
		}
	}
	
	public static int getPositionCrosswordY(){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			return POSITION_PLAY_SCREEN_CROSSWORD_HUGE_Y;
		case Utils.RESOURCE_TYPE_LARGE:
			return POSITION_PLAY_SCREEN_CROSSWORD_LARGE_Y;
		default:
			return (int) (POSITION_PLAY_SCREEN_CROSSWORD_LARGE_Y * Utils.getScale());
		}
	}
	public static void setPositionYourOption(FrameLayout.LayoutParams lp,int position){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			lp.topMargin = POSITION_PLAY_SCREEN_YOUR_OPTION_HUGE_Y;
			lp.leftMargin = POSITION_PLAY_SCREEN_YOUR_OPTION_HUGE_X+ position * getYourOptionSizePerCell();
			break;
		case Utils.RESOURCE_TYPE_LARGE:
			lp.topMargin = POSITION_PLAY_SCREEN_YOUR_OPTION_LARGE_Y;
			lp.leftMargin = POSITION_PLAY_SCREEN_YOUR_OPTION_LARGE_X+ position * getYourOptionSizePerCell();
			break;
		default:
			lp.topMargin = (int) (POSITION_PLAY_SCREEN_YOUR_OPTION_LARGE_Y * Utils.getScale());
			lp.leftMargin = (int) (POSITION_PLAY_SCREEN_YOUR_OPTION_LARGE_X * Utils.getScale())+ position * getYourOptionSizePerCell();
			break;
		}
	}
	public static void setPositionMyOption(FrameLayout.LayoutParams lp,int position){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			lp.topMargin = POSITION_PLAY_SCREEN_MY_OPTION_HUGE_Y;
			lp.leftMargin = POSITION_PLAY_SCREEN_MY_OPTION_HUGE_X + position * getMyOptionSizePerCell();
			break;
		case Utils.RESOURCE_TYPE_LARGE:
			lp.topMargin = POSITION_PLAY_SCREEN_MY_OPTION_LARGE_Y;
			lp.leftMargin = POSITION_PLAY_SCREEN_MY_OPTION_LARGE_X + position * getMyOptionSizePerCell();
			break;
		default:
			lp.topMargin = (int) (POSITION_PLAY_SCREEN_MY_OPTION_LARGE_Y * Utils.getScale());
			lp.leftMargin = (int) (POSITION_PLAY_SCREEN_MY_OPTION_LARGE_X * Utils.getScale()) + position * getMyOptionSizePerCell();
			break;
		}
	}
	public static int getSizeYourOptionWord(){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			return POSITION_PLAY_SCREEN_YOUR_OPTION_WIDTH_HUGE;
		case Utils.RESOURCE_TYPE_LARGE:
			return POSITION_PLAY_SCREEN_YOUR_OPTION_WIDTH_LARGE;
		default:
			return (int) (POSITION_PLAY_SCREEN_YOUR_OPTION_WIDTH_LARGE * Utils.getScale());
		}
	}
	public static int getSizeYourOptionWordWithoutSpace(){
		int a = 0;
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			a = 7;
		case Utils.RESOURCE_TYPE_LARGE:
			a = 4;
		default:
			a = (int) (3 * Utils.getScale());
		}
		return getSizeYourOptionWord() - a;
	}
	public static int getSizeMyOptionWord(){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			return POSITION_PLAY_SCREEN_MY_OPTION_WIDTH_HUGE ;
		case Utils.RESOURCE_TYPE_LARGE:
			return POSITION_PLAY_SCREEN_MY_OPTION_WIDTH_LARGE;
		default:
			return (int) (POSITION_PLAY_SCREEN_MY_OPTION_WIDTH_LARGE * Utils.getScale());
		}
	}
	public static int getSizeMyOptionWordWithoutSpace(){
		int a = 0;
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			a = 5;
		case Utils.RESOURCE_TYPE_LARGE:
			a = 3;
		default:
			a = (int) (3 * Utils.getScale());
		}
		return getSizeMyOptionWord() - a;
	}
	
	public static void setPositionLastestWord(FrameLayout.LayoutParams lp, int i){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			lp.topMargin = POSITION_PLAY_SCREEN_LASTEST_HUGE_Y;
			lp.leftMargin = POSITION_PLAY_SCREEN_LASTEST_HUGE_X + i * getYourOptionSizePerCell();
			break;
		case Utils.RESOURCE_TYPE_LARGE:
			lp.topMargin = POSITION_PLAY_SCREEN_LASTEST_LARGE_Y;
			lp.leftMargin = POSITION_PLAY_SCREEN_LASTEST_LARGE_X + i * getYourOptionSizePerCell();
			break;
		default:
			lp.topMargin = (int) (POSITION_PLAY_SCREEN_LASTEST_LARGE_Y * Utils.getScale());
			lp.leftMargin = (int) (POSITION_PLAY_SCREEN_LASTEST_LARGE_X * Utils.getScale()) + i * getYourOptionSizePerCell();
			break;
		}
	}
	public static int getSizeLastestWord(){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			return SIZE_LATEST_WORD_HUGE;
		case Utils.RESOURCE_TYPE_LARGE:
			return SIZE_LATEST_WORD_LARGE;
		default:
			return (int) (SIZE_LATEST_WORD_LARGE * Utils.getScale());
		}
	}
	public static void setPositionBtnPlay(FrameLayout.LayoutParams lp){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			lp.topMargin = POSITION_MAIN_SCREEN_PLAY_HUGE_Y;
			lp.leftMargin = POSITION_MAIN_SCREEN_PLAY_HUGE_X;
			break;
		case Utils.RESOURCE_TYPE_LARGE:
			lp.topMargin = POSITION_MAIN_SCREEN_PLAY_LARGE_Y;
			lp.leftMargin = POSITION_MAIN_SCREEN_PLAY_LARGE_X;
			break;
		default:
			lp.topMargin = (int) (POSITION_MAIN_SCREEN_PLAY_LARGE_Y * Utils.getScale());
			lp.leftMargin = (int) (POSITION_MAIN_SCREEN_PLAY_LARGE_X * Utils.getScale());
//			System.out.println("scale:"+lp.topMargin+","+lp.leftMargin);
			break;
		}
	}
	public static void setPositionBtnExit(FrameLayout.LayoutParams lp){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
//			lp.setMargins(POSITION_MAIN_SCREEN_EXIT_HUGE_X, POSITION_MAIN_SCREEN_EXIT_HUGE_Y, 0, 0);
			lp.topMargin = POSITION_MAIN_SCREEN_EXIT_HUGE_Y;
			lp.leftMargin = POSITION_MAIN_SCREEN_EXIT_HUGE_X;
			break;
		case Utils.RESOURCE_TYPE_LARGE:
//			lp.setMargins(POSITION_MAIN_SCREEN_EXIT_LARGE_X, POSITION_MAIN_SCREEN_EXIT_LARGE_Y, 0, 0);
			lp.topMargin = POSITION_MAIN_SCREEN_EXIT_LARGE_Y;
			lp.leftMargin = POSITION_MAIN_SCREEN_EXIT_LARGE_X;
			break;
		default:
//			lp.setMargins((int)(POSITION_MAIN_SCREEN_EXIT_LARGE_X * Utils.getScale()), (int) (POSITION_MAIN_SCREEN_EXIT_LARGE_Y * Utils.getScale()), 0, 0);
			lp.topMargin = (int) (POSITION_MAIN_SCREEN_EXIT_LARGE_Y * Utils.getScale());
			lp.leftMargin = (int)(POSITION_MAIN_SCREEN_EXIT_LARGE_X * Utils.getScale());
//			System.out.println("scale:"+lp.topMargin+","+lp.leftMargin);
			break;
		}
	}
	public static void setPositionBtnBack(FrameLayout.LayoutParams lp){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			lp.topMargin = POSITION_PLAY_SCREEN_BACK_HUGE_Y;
			lp.leftMargin = POSITION_PLAY_SCREEN_BACK_HUGE_X;
			break;
		case Utils.RESOURCE_TYPE_LARGE:
			lp.topMargin = POSITION_PLAY_SCREEN_BACK_LARGE_Y;
			lp.leftMargin = POSITION_PLAY_SCREEN_BACK_LARGE_X;
			break;
		default:
			lp.topMargin = (int) (POSITION_PLAY_SCREEN_BACK_LARGE_Y * Utils.getScale());
			lp.leftMargin = (int)(POSITION_PLAY_SCREEN_BACK_LARGE_X * Utils.getScale());
			break;
		}
	}
	public static void setPositionConnectSelect(FrameLayout.LayoutParams lp){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			lp.topMargin = POSITION_CONNECT_SCREEN_SELECT_HUGE_Y;
			lp.leftMargin = POSITION_CONNECT_SCREEN_SELECT_HUGE_X;
			break;
		case Utils.RESOURCE_TYPE_LARGE:
			lp.topMargin = POSITION_CONNECT_SCREEN_SELECT_LARGE_Y;
			lp.leftMargin = POSITION_CONNECT_SCREEN_SELECT_LARGE_X;
			break;
		default:
			lp.topMargin = (int) (POSITION_CONNECT_SCREEN_SELECT_LARGE_Y * Utils.getScale());
			lp.leftMargin = (int)(POSITION_CONNECT_SCREEN_SELECT_LARGE_X * Utils.getScale());
			break;
		}
	}
	public static void setPositionConnectBack(FrameLayout.LayoutParams lp){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			lp.topMargin = POSITION_CONNECT_SCREEN_BACK_HUGE_Y;
			lp.leftMargin = POSITION_CONNECT_SCREEN_BACK_HUGE_X;
			break;
		case Utils.RESOURCE_TYPE_LARGE:
			lp.topMargin = POSITION_CONNECT_SCREEN_BACK_LARGE_Y;
			lp.leftMargin = POSITION_CONNECT_SCREEN_BACK_LARGE_X;
			break;
		default:
			lp.topMargin = (int) (POSITION_CONNECT_SCREEN_BACK_LARGE_Y * Utils.getScale());
			lp.leftMargin = (int)(POSITION_CONNECT_SCREEN_BACK_LARGE_X * Utils.getScale());
			break;
		}
	}
	public static int getCellSpace(){
		switch(Utils.getResourceType()){
		case Utils.RESOURCE_TYPE_HUGE:
			return SIZE_PER_CELL_PLAY_SCREEN_SPACE_HUGE;
			
		case Utils.RESOURCE_TYPE_LARGE:
			return SIZE_PER_CELL_PLAY_SCREEN_SPACE_LARGE;
			
		default:
			return SIZE_PER_CELL_PLAY_SCREEN_LARGE;
			
		}
	}
}
